package se.jayway.millionaire.engine;

import se.jayway.millionaire.listener.GameRoundFinishedException;

public class PlayerChoice {

	private final PlayerScore score;
	private String playerAnswer;

	public PlayerChoice(PlayerScore score) {
		this.score = score;
	}
	
	public String getPlayerAnswer() {
		return playerAnswer;
	}

	public void setPlayerAnswer(String answer) {
		if (isFinished()) {
			throw new GameRoundFinishedException("Sorry, this game round is finished");
		}
		this.playerAnswer = answer;
	}
	
	public boolean isFinished() {
		return GameManager.getInstance().isGameRoundFinished();
	}

	public PlayerScore getScore() {
		return score;
	}
}
